Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install buildifier via Bazel #2777

Merged
merged 3 commits into from
Sep 24, 2024
Merged

Install buildifier via Bazel #2777

merged 3 commits into from
Sep 24, 2024

Conversation

npaun
Copy link
Member

@npaun npaun commented Sep 23, 2024

No description provided.

@npaun npaun force-pushed the npaun/buildifier-in-bazel branch 2 times, most recently from 946be0a to 9a68e92 Compare September 23, 2024 22:52
@npaun npaun marked this pull request as ready for review September 23, 2024 22:52
@npaun npaun requested review from a team as code owners September 23, 2024 22:52
devtools/BUILD.bazel Outdated Show resolved Hide resolved
WORKSPACE Show resolved Hide resolved
@npaun
Copy link
Member Author

npaun commented Sep 24, 2024

Based on @danlapid's suggestion, I added some code to let format.py run the tool directly and avoid invoking bazel each time.

Copy link
Contributor

@danlapid danlapid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it!

@npaun npaun force-pushed the npaun/buildifier-in-bazel branch 2 times, most recently from f60d34d to 348c80f Compare September 24, 2024 15:55
@fhanau
Copy link
Collaborator

fhanau commented Sep 24, 2024

What I meant with my comment re. config_setting_group was to still have them to define an alias for the binary with the right architecture, but to define the groups in a new file in the build folder and use that to fold up the groups that we have so far in rust-deps/BUILD.bazel. That feels cleaner than doing platform selection in python, but I assume that would cause issues with running the binary directly instead of through bazel, so not opposed to this approach.

@npaun
Copy link
Member Author

npaun commented Sep 24, 2024

@fhanau Yep, your suggestion makes sense, but I wanted direct running of the binary to speed things up where possible.

# formatter=prettier,
# ),
# FormatConfig(directory="src", globs=("*.json",), formatter=prettier),
FormatConfig(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restoring prettier because it is already installed by bazel

# globs=("*.bzl", "WORKSPACE", "BUILD", "BUILD.*"),
# formatter=buildifier,
# ),
FormatConfig(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restoring buildifier because this PR installs it via Bazel

# formatter=prettier,
# ),
# FormatConfig(directory="src", globs=("*.json",), formatter=prettier),
FormatConfig(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was prettier intended to be included? Imo it requires running npm install or something and is not fetched automatically?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's listed as a runtime dependency of workerd, so it's somewhere... I'm currently doing a clean build to find out where it puts it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found it (bazel-bin/node_modules/prettier/bin/prettier.cjs)

Copy link
Collaborator

@mikea mikea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this. I have #2775 in the works that will hopefully make managing these easier.

@mikea
Copy link
Collaborator

mikea commented Sep 24, 2024

What I meant with my comment re. config_setting_group was to still have them to define an alias for the binary with the right architecture, but to define the groups in a new file in the build folder and use that to fold up the groups that we have so far in rust-deps/BUILD.bazel. That feels cleaner than doing platform selection in python, but I assume that would cause issues with running the binary directly instead of through bazel, so not opposed to this approach.

I thought about this too, and while it can be done I don't see a particular value of doing it that way. You'll have to do bazel run then, which has its own drawbacks. This change is simple enough so lg.

@npaun npaun merged commit de462cb into main Sep 24, 2024
11 checks passed
@npaun npaun deleted the npaun/buildifier-in-bazel branch September 24, 2024 17:29
jclee pushed a commit that referenced this pull request Oct 11, 2024
* Install buildifier via Bazel

* Update path to prettier

* Update path to prettier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants